package basica.academico;

import java.util.ArrayList;
import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

@Entity
@Table(name = "TBGRADE")
public class Grade {

	@Id @GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="CodGrade")
	private Integer codigo;
	
	@Column(name="SemesGrade")
	private String semestre;
	
	@ManyToMany(fetch=FetchType.LAZY)
	@JoinTable(name="TBGRADEDISCIPLINA", joinColumns=@JoinColumn(name="codGrade"),
				inverseJoinColumns=@JoinColumn(name="CodDisciplina"))
	private Collection<DisciplinaAtiva> materia;
	
	public Grade(){
		
	}

	public Grade(Integer codigo, String semestre) {
		super();
		this.codigo = codigo;
		this.semestre = semestre;
		this.materia = new ArrayList<DisciplinaAtiva>();
	}

	public Integer getCodigo() {
		return codigo;
	}

	public void setCodigo(Integer codigo) {
		this.codigo = codigo;
	}

	public String getSemestre() {
		return semestre;
	}

	public void setSemestre(String semestre) {
		this.semestre = semestre;
	}

	public Collection<DisciplinaAtiva> getMateria() {
		return materia;
	}

	public void setMateria(Collection<DisciplinaAtiva> materia) {
		this.materia = materia;
	}
	
}
